﻿CREATE VIEW [dbo].[ASMS_V_SettlementBillMaterial]
	AS 
SELECT SBM.*,
	M.Name as MaterialName,
	MRB.Status as ActualStatus,
	MRB.Handler as Handler,
	S1.Name as HandlerName
FROM ASMS_SettlementBillMaterial as SBM
	left join ASMS_Material as M on M.Id = SBM.MaterialId
	left join ASMS_MaterialRequisitionBill as MRB on MRB.[Status]= 1 and  MRB.MaintenanceBillMaterialId = SBM.MaintenanceBillMaterialId
	left join ASMS_Staff as S1 on S1.Id = MRB.Handler